Skip to content

Conversation

ZNeumann
Copy link
Contributor

@ZNeumann ZNeumann commented May 30, 2025

Some transaction globals were leaked when calling newrelic_end_transaction(true). The freeing of these transaction globals has been moved to join all the other transaction globals to alleviate this.

In so doing, additional rshutdown methods are needed. This is because the transaction globals contain reference incremented zvals. If we wait until postdeactivate, those zvals will be in an undefined state and the data structures containing those references cannot be properly freed. In line with other transaction globals, we trigger a shutdown method during rshutdown to free these globals while the zvals are still valid.

@newrelic-php-agent-bot
Copy link

newrelic-php-agent-bot commented May 30, 2025

Test Suite Status Result
Multiverse 15/16 passing
SOAK 84/85 passing

@codecov-commenter
Copy link

codecov-commenter commented May 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.12%. Comparing base (22d0138) to head (5b8dd71).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1072   +/-   ##
=======================================
  Coverage   78.11%   78.12%           
=======================================
  Files         193      193           
  Lines       27991    27999    +8     
=======================================
+ Hits        21866    21875    +9     
+ Misses       6125     6124    -1     
Flag Coverage Δ
agent-for-php-7.2 78.37% <100.00%> (+<0.01%) ⬆️
agent-for-php-7.3 78.39% <100.00%> (+<0.01%) ⬆️
agent-for-php-7.4 78.25% <100.00%> (+<0.01%) ⬆️
agent-for-php-8.0 77.45% <100.00%> (+<0.01%) ⬆️
agent-for-php-8.1 77.77% <100.00%> (+0.01%) ⬆️
agent-for-php-8.2 77.38% <100.00%> (+0.01%) ⬆️
agent-for-php-8.3 77.38% <100.00%> (+0.01%) ⬆️
agent-for-php-8.4 77.40% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ZNeumann ZNeumann force-pushed the zjn/valgrind branch 2 times, most recently from 5deff4d to e953a97 Compare June 16, 2025 15:05
@ZNeumann ZNeumann changed the base branch from zjn/valgrind to dev June 18, 2025 11:58
@ZNeumann ZNeumann marked this pull request as ready for review June 18, 2025 12:21
@zsistla zsistla added this to the next-release milestone Aug 11, 2025
* Purpose : Frees reference incremented, transaction global zvals
* that must be cleaned up prior to postdeactivate
*/
extern void nr_mysqli_rshutdown();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a naming convention that symbols that are PHP runtime aware and are defined in the agent have the prefix of nr_php_ and the functions that are agnostic of PHP runtime and are defined in axiom have the prefix of nr_. This convention helps in reasoning about the code when reading it. Please update the name of this function to nr_php_mysqli_rshutdown.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed in 5b8dd71

agent/php_pdo.h Outdated
* Purpose : Frees reference incremented, transaction global zvals
* that must be cleaned up prior to postdeactivate
*/
extern void nr_pdo_rshutdown();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a naming convention that symbols that are PHP runtime aware and are defined in the agent have the prefix of nr_php_ and the functions that are agnostic of PHP runtime and are defined in axiom have the prefix of nr_. This convention helps in reasoning about the code when reading it. Please update the name of this function to nr_php_pdo_rshutdown.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed in 5b8dd71

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants